def main():
    n = 4
    p = [9, 8, 17, 6]

    s = 0
    for i in p:
        s += i
        
    avg = s / n

    for i in range(n):
        p[i] -= avg

    step = 0
    for i in range(n - 1):
        v = p[i]
        p[i + 1] += v 
        p[i] = 0
        step += 1

    print('step count:', step)

main()

